package com.chc.enums;

import lombok.Getter;

/**
 * @Author: chc
 * @Date: 2025/01/15/15:04
 * @Description: 用户类型枚举（后续可扩展）
 */
@Getter
public enum UserTypeEnum {

    ADMIN_USER(1,"超级管理员"),
    USER(0,"普通用户");

    public Integer code;
    public String desc;

    UserTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static UserTypeEnum getByCode(Integer code){
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (userTypeEnum.getCode().equals(code)){
                return userTypeEnum;
            }
        }
        return null;
    }
}
